home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1998 November / Freeware November 1998.img / dist / fw_msql.idb / usr / freeware / msql / include / msql.h.z / msql.h
C/C++ Source or Header  |  1998-10-27  |  4KB  |  154 lines

  1. /*
  2. **    msql.h    - 
  3. **
  4. **
  5. ** Copyright (c) 1993-95  David J. Hughes
  6. ** Copyright (c) 1995  Hughes Technologies Pty Ltd
  7. **
  8. ** Permission to use, copy, and distribute for non-commercial purposes,
  9. ** is hereby granted without fee, providing that the above copyright
  10. ** notice appear in all copies and that both the copyright notice and this
  11. ** permission notice appear in supporting documentation.
  12. **
  13. ** This software is provided "as is" without any expressed or implied warranty.
  14. **
  15. ** ID = "$Id:"
  16. **
  17. */
  18.  
  19.  
  20. #ifndef MSQL_H
  21. #define MSQL_H
  22.  
  23.  
  24. #if defined(__STDC__) || defined(__cplusplus)
  25. #  define __ANSI_PROTO(x)    x
  26. #else
  27. #  define __ANSI_PROTO(x)    ()
  28. #endif
  29.  
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33.  
  34. typedef    char    ** m_row;
  35.  
  36. typedef struct field_s {
  37.     char    *name,
  38.         *table;
  39.     int    type,
  40.         length,
  41.         flags;
  42. } m_field;
  43.  
  44.  
  45. typedef struct     m_seq_s {
  46.     int    step,
  47.         value;
  48. } m_seq;
  49.  
  50.  
  51. typedef    struct    m_data_s {
  52.     int    width;
  53.     m_row    data;
  54.     struct    m_data_s *next;
  55. } m_data;
  56.  
  57. typedef struct m_fdata_s {
  58.     m_field    field;
  59.     struct m_fdata_s *next;
  60. } m_fdata;
  61.  
  62.  
  63.  
  64. typedef struct result_s {
  65.         m_data     *queryData,
  66.                 *cursor;
  67.     m_fdata    *fieldData,
  68.         *fieldCursor;
  69.     int    numRows,
  70.         numFields;
  71. } m_result;
  72.  
  73.  
  74. #define    msqlNumRows(res) res->numRows
  75. #define    msqlNumFields(res) res->numFields
  76.  
  77.  
  78. #define INT_TYPE    1
  79. #define CHAR_TYPE    2
  80. #define REAL_TYPE    3
  81. #define IDENT_TYPE    4
  82. #define NULL_TYPE    5
  83. #define TEXT_TYPE    6
  84. #define DATE_TYPE    7
  85. #define UINT_TYPE    8
  86. #define MONEY_TYPE    9
  87. #define TIME_TYPE    10
  88. #define LAST_REAL_TYPE    10
  89. #define IDX_TYPE    253
  90. #define SYSVAR_TYPE    254
  91. #define    ANY_TYPE    255
  92.  
  93. #define NOT_NULL_FLAG   1
  94. #define UNIQUE_FLAG    2
  95.  
  96. #define IS_UNIQUE(n)    (n & UNIQUE_FLAG)
  97. #define IS_NOT_NULL(n)    (n & NOT_NULL_FLAG)
  98.  
  99. static char msqlTypeNames[][12] = 
  100.     {"???", "int", "char","real","ident","null","text","date","uint",
  101.     "money","time","???"};
  102.  
  103.  
  104. /*
  105. ** Pre-declarations for the API library functions
  106. */
  107. #ifndef _MSQL_SERVER_SOURCE
  108.     extern  char msqlErrMsg[];
  109.     int     msqlConnect __ANSI_PROTO((char *));
  110.     int     msqlSelectDB __ANSI_PROTO((int, char*));
  111.     int     msqlQuery __ANSI_PROTO((int, char*));
  112.     int     msqlCreateDB __ANSI_PROTO((int, char*));
  113.     int     msqlDropDB __ANSI_PROTO((int, char*));
  114.     int     msqlShutdown __ANSI_PROTO((int));
  115.     int     msqlGetProtoInfo __ANSI_PROTO((void));
  116.     int     msqlReloadAcls __ANSI_PROTO((int));
  117.     int     msqlGetServerStats __ANSI_PROTO((int));
  118.     char     *msqlGetServerInfo __ANSI_PROTO((void));
  119.     char     *msqlGetHostInfo __ANSI_PROTO((void));
  120.     char     *msqlUnixTimeToDate __ANSI_PROTO((time_t));
  121.     char     *msqlUnixTimeToTime __ANSI_PROTO((time_t));
  122.     void    msqlClose __ANSI_PROTO((int));
  123.     void     msqlDataSeek __ANSI_PROTO((m_result*, int));
  124.     void     msqlFieldSeek __ANSI_PROTO((m_result*, int));
  125.     void     msqlFreeResult __ANSI_PROTO((m_result*));
  126.         m_row   msqlFetchRow __ANSI_PROTO((m_result*));
  127.     m_seq    *msqlGetSequenceInfo __ANSI_PROTO((int, char*));
  128.     m_field    *msqlFetchField __ANSI_PROTO((m_result *));
  129.     m_result *msqlListDBs __ANSI_PROTO((int));
  130.     m_result *msqlListTables __ANSI_PROTO((int));
  131.     m_result *msqlListFields __ANSI_PROTO((int, char*));
  132.     m_result *msqlListIndex __ANSI_PROTO((int, char*, char*));
  133.     m_result *msqlStoreResult __ANSI_PROTO((void));
  134.     time_t    msqlDateToUnixTime __ANSI_PROTO((char *));
  135.     time_t    msqlTimeToUnixTime __ANSI_PROTO((char *));
  136. #endif
  137.  
  138. #ifdef _MSQL_SERVER_SOURCE
  139.     /*
  140.     ** These functions are not part of the mSQL API.  Any use
  141.     ** of these functions is discouraged as the interface may
  142.     ** change in future releases
  143.     */
  144.     int    msqlLoadConfigFile __ANSI_PROTO((char *));
  145.     int     msqlGetIntConf __ANSI_PROTO((char *, char *));
  146.     char     *msqlGetCharConf __ANSI_PROTO((char *, char*));
  147. #endif
  148.  
  149.  
  150. #ifdef __cplusplus
  151.     }
  152. #endif
  153. #endif /*MSQL_H*/
  154.